package com.qingke.hibernate.bean;

import java.sql.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name="school_year")
//@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class SchoolYear {
	@Id
	@Column(name="id")
	private int id;
	
	@Column(name="year")
	private Date year;
	
	@OneToMany(mappedBy="schoolYear")
	private Set<CourseModel> courseModels;
	
	@OneToMany(mappedBy="schoolYear")
	private Set<Register> registers;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public Date getYear() {
		return year;
	}
	public void setYear(Date year) {
		this.year = year;
	}
	public Set<CourseModel> getCourseModels() {
		return courseModels;
	}
	public void setCourseModels(Set<CourseModel> courseModels) {
		this.courseModels = courseModels;
	}
	public Set<Register> getRegisters() {
		return registers;
	}
	public void setRegisters(Set<Register> registers) {
		this.registers = registers;
	}
	
	@Override
	public String toString() {
		return "SchoolYear [id=" + id + ", year=" + year.toString().split("-")[0] + "]";
	}
}
